package com.liuxin.zhiyuan.shujuzhongxin.service.impl;

import com.liuxin.zhiyuan.shujuzhongxin.domain.dto.MajorInfoListDTO;
import com.liuxin.zhiyuan.shujuzhongxin.mapper.CareerinfoMapper;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.liuxin.common.utils.PageUtils;
import com.liuxin.common.utils.Query;

import com.liuxin.zhiyuan.shujuzhongxin.domain.po.CareerinfoEntity;
import com.liuxin.zhiyuan.shujuzhongxin.service.CareerinfoService;


@Service
public class CareerinfoServiceImpl extends ServiceImpl<CareerinfoMapper, CareerinfoEntity> implements CareerinfoService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<CareerinfoEntity> page = this.page(
                new Query<CareerinfoEntity>().getPage(params),
                new QueryWrapper<CareerinfoEntity>()
        );

        return new PageUtils(page);
    }

    @Override
    public PageUtils queryCareerInfoPage(Map<String, Object> params) {
        // 构建查询条件
        String career = (String) params.get("career");
        // 创建分页对象
        IPage<MajorInfoListDTO> page = new Query<MajorInfoListDTO>().getPage(params);
        // 执行自定义SQL查询
        IPage<MajorInfoListDTO> resultPage = this.baseMapper.selectCareerInfoPage(page, career);
        return new PageUtils(resultPage);
    }

}